/**
 * <copyright>
 * </copyright>
 *
 */
package de.sabram.upb.specs.lido.impl;

import de.sabram.upb.specs.lido.LidoPackage;
import de.sabram.upb.specs.lido.RuleId;
import de.sabram.upb.specs.lido.RuleSpecId;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Rule Spec Id</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.sabram.upb.specs.lido.impl.RuleSpecIdImpl#getRuleId <em>Rule Id</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RuleSpecIdImpl extends MinimalEObjectImpl.Container implements RuleSpecId
{
  /**
   * The cached value of the '{@link #getRuleId() <em>Rule Id</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRuleId()
   * @generated
   * @ordered
   */
  protected RuleId ruleId;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected RuleSpecIdImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return LidoPackage.Literals.RULE_SPEC_ID;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public RuleId getRuleId()
  {
    return ruleId;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetRuleId(RuleId newRuleId, NotificationChain msgs)
  {
    RuleId oldRuleId = ruleId;
    ruleId = newRuleId;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LidoPackage.RULE_SPEC_ID__RULE_ID, oldRuleId, newRuleId);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setRuleId(RuleId newRuleId)
  {
    if (newRuleId != ruleId)
    {
      NotificationChain msgs = null;
      if (ruleId != null)
        msgs = ((InternalEObject)ruleId).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LidoPackage.RULE_SPEC_ID__RULE_ID, null, msgs);
      if (newRuleId != null)
        msgs = ((InternalEObject)newRuleId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LidoPackage.RULE_SPEC_ID__RULE_ID, null, msgs);
      msgs = basicSetRuleId(newRuleId, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, LidoPackage.RULE_SPEC_ID__RULE_ID, newRuleId, newRuleId));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case LidoPackage.RULE_SPEC_ID__RULE_ID:
        return basicSetRuleId(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case LidoPackage.RULE_SPEC_ID__RULE_ID:
        return getRuleId();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case LidoPackage.RULE_SPEC_ID__RULE_ID:
        setRuleId((RuleId)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.RULE_SPEC_ID__RULE_ID:
        setRuleId((RuleId)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case LidoPackage.RULE_SPEC_ID__RULE_ID:
        return ruleId != null;
    }
    return super.eIsSet(featureID);
  }

} //RuleSpecIdImpl
